<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回一个可用驱动的数组</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="pdo.getattribute.html">« PDO::getAttribute</a></li>
      <li style="float: right;"><a href="pdo.intransaction.html">PDO::inTransaction »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.pdo.html">PDO</a></li>
    <li>返回一个可用驱动的数组</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="pdo.getavailabledrivers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PDO::getAvailableDrivers</h1>
  <h1 class="refname">pdo_drivers</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8, PECL pdo &gt;= 1.0.3)</p><p class="refpurpose"><span class="refname">PDO::getAvailableDrivers</span> -- <span class="refname">pdo_drivers</span> &mdash; <span class="dc-title">
   返回一个可用驱动的数组
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pdo.getavailabledrivers-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>PDO::getAvailableDrivers</strong></span>(): <span class="type">array</span></div>

  <div class="methodsynopsis dc-description"><span class="methodname"><strong>pdo_drivers</strong></span>(): <span class="type">array</span></div>

  <p class="para rdfs-comment">
   此函数（方法）返回所有当前可用在 <span class="function"><a href="pdo.construct.html" class="function">PDO::__construct()</a></span> 的参数 <code class="parameter">DSN</code> 中的 PDO 驱动。
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-pdo.getavailabledrivers-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-pdo.getavailabledrivers-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <span class="function"><strong>PDO::getAvailableDrivers()</strong></span> 返回一个 包含可用 PDO 驱动名字的数组。如果没有可用的驱动，则返回一个空数组。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-pdo.getavailabledrivers-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1046">
    <p><strong>示例 #1 一个 <span class="function"><strong>PDO::getAvailableDrivers()</strong></span> 的例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">getAvailableDrivers</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [0] =&gt; mysql
    [1] =&gt; sqlite
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>